package cn.jslancer.spider;

import cn.jslancer.domain.Article;
import cn.jslancer.repository.ArticleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author jslancer
 * @date 2017/11/5
 */
@Component
public class ArticlePipeline implements DataPipeline<Article> {

    @Autowired
    private ArticleRepository articleRepository;

    @Override
    public Article processData(Article article) {
        if (article != null) {
            articleRepository.save(article);
        }
        return article;
    }
}
